# Maintainer: Konstantin Gizdov <arch at kge dot pw>

pkgname='msgpack-cxx'
pkgver=5.0.0
pkgrel=1
pkgdesc='An efficient object serialization library for C++'
arch=("any")
url='https://msgpack.org/'
license=('custom:Boost')
makedepends=('cmake' 'doxygen' 'graphviz')
depends=('boost')
source=("https://github.com/msgpack/msgpack-c/releases/download/cpp-${pkgver}/${pkgname}-${pkgver}.tar.gz"
        "LICENSE-${pkgname}-${pkgver}::https://raw.githubusercontent.com/msgpack/msgpack-c/cpp_master/COPYING")
b2sums=('e631a47e8d39b6ad9c2dd5e782fbbd5044c177e18c619fb52d1293e2c5f2ea7e766e7b26ce6cac36a2ff98217143e12456e0541992afb4f78597ffd3852f2acf'
        'f39585a8a06390e7677a46fd62c1836d2873ceb6e66927803fcbf42a572b5c6c0948b5191708bf1fe04c79b94de574d1d1ef19eaca28e81326af6ef1757c1d94')
_builddir='build-cxx'

prepare() {
  cd "${srcdir}"
  mkdir "${_builddir}"
}

build() {
  cd "${srcdir}/${_builddir}"
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_SHARED_LIBS=ON \
        -DMSGPACK_CXX17=ON \
        -DMSGPACK_BUILD_EXAMPLES=OFF \
        -DMSGPACK_BUILD_TESTS=ON \
        "${srcdir}/${pkgname}-${pkgver}"
  make
}

check() {
  cd "${srcdir}/${_builddir}"
  make test 
}

package() {
  cd "${srcdir}/${_builddir}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}/LICENSE-${pkgname}-${pkgver}" "${pkgdir}/usr/share/licenses/${pkgname}"/LICENSE
}
